import logging
import sys

from intellirust import Context

logging.getLogger('intellirust').setLevel(logging.CRITICAL)

args = sys.argv[1:]

if len(args) != 3:
    print(f'Invalid arguments, current: {args}', file=sys.stderr)
    exit(1)

path = args[0]
src = args[1]
sig = args[2]

try:
    ctx = Context(path, src, sig)
    print(ctx.build().to_str())
except Exception as e:
    print(e, file=sys.stderr)
    exit(1)
